﻿namespace SampleMvcApplication.Controllers {
    using System.Web.Mvc;
    using Models;

    [HandleError]
    public class HomeController : Controller {

        // There is no empty action to handle the /GET Index request
        // because inferred actions handle that request.

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Index(PersonInputModel inputModel) {

            var message = (inputModel != null) ? "Good data!" : null;

            // Since the 'model' is a string, the MVC framework thinks
            // the name of the view is "Good data!", so we will need to 
            // specify the name of the view
            return View("Index", message);
        }
    }
}